<%@ include file="header.jsp" %>
<% if (session.getAttribute("userClass").equals("a")) { %>
<h1>Edit User</h1>

<h2>Personal Info</h2>
<fieldset>
	<legend>${user.username}</legend>
	<form class="user_info" id="edit_user_form" name="edit_user" method="post" action="EditUser">
		${messages.update_msg}
		<label for="password" >Password:</label>
		<input class="required" name="password" type="password" value="${user.password}"> 
		<label for="userclass">Class</label>
			<select name="userclass">
				<option ${user.userclass == 'p' ? 'selected' : ''} value="p">Person</option>
				<option ${user.userclass == 'd' ? 'selected' : ''} value="d">Doctor</option>
				<option ${user.userclass == 'r' ? 'selected' : ''} value="r">Radiologist</option>
				<option ${user.userclass == 'a' ? 'selected' : ''} value="a">Administrator</option>
			</select>
		
		<label for="first_name">First Name:</label>
		<input name="first_name" type="text" value="${user.firstname}"> 

		<label for="last_name">Last Name:</label>
		<input name="last_name" type="text" value="${user.lastname}"> 		
		
		<label for="address">Address:</label>
		<input name="address" type="text" value="${user.address}"> 		

		<label for="email">Email:</label>
		<input class="required email" name="email" type="text" value="${user.email}"> 		

		<label for="phone">Phone:</label>
		<input name="phone" type="text" value="${user.phone}"> 				

		<input name="username" type="hidden" value="${user.username}">
		<input type="submit" value="submit">
	</form>	
</fieldset>

<h2>Doctors</h2>
<c:if test="${doctors != null}">
<table>
<c:forEach var="doctor" items="${doctors}">
<tr>
<td>${doctor}</td>
<td><a id=${doctor} class="doctor_remove" href="RemoveDoctor?username=${user.username}&doctor=${doctor}">Remove</a></td>
</tr>
</c:forEach>
</table>
</c:if>

<c:if test="${doctors != null}">
<h3>Add Doctor</h3>
<form id="add_doctor" method="POST" name="add_doctor" action="AddDoctor">
${messages.add_doctor_msg}
<select name="doctor">
	<c:forEach var="doctor" items="${allDoctors}">
	<option value="${doctor}">${doctor }</option>
	</c:forEach>
</select>
<input type="hidden" name="username" value="${user.username}">
<input type="submit" value="Add">
</form>
</c:if>
<% } %>
<%@ include file="footer.jsp" %>

